import React from 'react'
import ReactDOM from 'react-dom/client'
import {BrowserRouter} from 'react-router-dom'
import Routers from './router'
import RootProvider from './RootProvider'
import {ConfigProvider} from 'antd'
import {QueryClient, QueryClientProvider} from '@tanstack/react-query'
import request from '@/request/request'
import { antI18n } from "./i18n";
import './i18n'
import './index.css'
const queryClient = new QueryClient({
    defaultOptions: {
        queries: {
            refetchOnWindowFocus: false,
            retry:false,
            queryFn: ({ queryKey }) => request(...queryKey),
        },
        mutations: {
            mutationFn: variables => request(...variables),
        },
    }
})
ReactDOM.createRoot(document.getElementById('root')).render(
    <React.StrictMode>
        <RootProvider>
            <QueryClientProvider client={queryClient}>
              <ConfigProvider locale={antI18n}>
                  <BrowserRouter>
                      <Routers/>
                  </BrowserRouter>
              </ConfigProvider>
            </QueryClientProvider>
        </RootProvider>
    </React.StrictMode>
)
